<template>
  <div class="avue-sidebar">
    <logo></logo>

    <el-scrollbar style="height:97%;margin-top: 60px">
      <div v-if="validatenull(menu)"
           class="avue-sidebar--tip" >{{$t('menuTip')}}</div>
      <el-menu unique-opened
               :default-active="nowTagValue"
               mode="vertical"
               :show-timeout="200"
               :collapse="keyCollapse">
        <sidebar-item :menu="menu"
                      :screen="screen"
                      first
                      :props="website.menu.props"
                      :collapse="keyCollapse"></sidebar-item>
      </el-menu>
    </el-scrollbar>

    <footer style="height: 3%;padding-left: 20px;"  @click="setCollapse">

<!--          <div class="top-bar__left">-->
<!--            <div class="avue-breadcrumb"-->
<!--                 :class="[{ 'avue-breadcrumb&#45;&#45;active': isCollapse }]"-->
<!--                 v-if="showCollapse">-->
<!--              <i class="icon-navicon"-->
<!--                 @click="setCollapse"></i>-->
      <img src="https://yulonghuyu.oss-cn-hangzhou.aliyuncs.com/app-web/xitong/%E7%9F%A9%E5%BD%A2%2010%20%E6%8B%B7%E8%B4%9D%202%402x.png" style="width: 18px;height: 14px;">
<!--            </div>-->
<!--          </div>-->
    </footer>
  </div>
</template>

<script>
import {mapGetters, mapState} from "vuex";
import logo from "../logo";
import sidebarItem from "./sidebarItem";
export default {
  name: "sidebar",
  components: { sidebarItem, logo },
  data() {
    return {};
  },
  created() {
    this.$store.dispatch("GetMenu").then(data => {
      if (data.length === 0) return;
      this.$router.$avueRouter.formatRoutes(data, true);
    });
  },
  computed: {
    ...mapGetters(["website", "menu", "tag", "keyCollapse", "screen",]),
    nowTagValue: function() {
      return this.$router.$avueRouter.getValue(this.$route);
    },
    ...mapState({
      showCollapse: state => state.common.showCollapse,
    }),
  },
  mounted() {},
  methods: {
    setCollapse() {
      this.$store.commit("SET_COLLAPSE");
    },
  }
};
</script>
<style lang="scss" scoped>
</style>

